package com.community.web.user.controller.common;


import com.community.common.result.Result;
import com.community.model.entity.GoodsCategory;
import com.community.web.user.service.GoodsCategoryService;
import com.community.web.user.service.SpecialService;
import com.community.web.user.vo.SpecialVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "首页模块")
@RestController
@RequestMapping("/common")
public class SpecialController {

    @Autowired
    private SpecialService specialService;

    @Autowired
    private GoodsCategoryService goodsCategoryService;

    @ApiOperation("获取促销模块列表")
    @GetMapping("special")
    public Result<List<SpecialVo>> getList(){
        List<SpecialVo> result = specialService.selectList();
        return Result.ok(result);
    }

    @ApiOperation("查询商品三级类别列表")
    @GetMapping("category")
    public Result<List<GoodsCategory>> selectCategoryList(){
        List<GoodsCategory> list = goodsCategoryService.list();
        return Result.ok(list);
    }
}
